﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AltimilliaLibrary.Base_Object;
using Microsoft.Xna.Framework;

namespace AltimilliaLibrary.LocationManagement
{
    public class Location : IAltimilliaGameComponent
    {
        private SpriteManager manager;

        public Location(SpriteManager spriteManager)
        {
            manager = spriteManager;
        }

        public delegate void MovedToTile(String locationName, Point tile);
        public event MovedToTile TileMoved;

        public String Name { get; set; }

        public BaseManager Manager {get;set;}
        public bool Enabled { get; set; }
        public event EventHandler EnabledChanged;

        public void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            manager.Update(gameTime);
        }

        public int UpdateOrder { get; set; }
        public event EventHandler UpdateOrderChanged;

        public void Initialize()
        {
            manager.Initialize();
        }

        public void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            manager.Draw(gameTime);
        }

        public int DrawOrder { get; set; }

        public event EventHandler DrawOrderChanged;

        public bool Visible { get; set; }

        public event EventHandler VisibleChanged;

        public void MainCharactedMoved(Point oldPosition, Point newPosition)
        {
            if (TileMoved != null)
            {
                TileMoved(Name, newPosition);
            }
        }

    }
}
